﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Water.Architecture2.EntityXML;
using Water.Architecture2.Model;

namespace Water.Web.Prompt
{
    class PromptEntityXML
    {
        private System.Collections.Hashtable ht = new System.Collections.Hashtable();
     

        public System.Collections.Hashtable GetPrompts()
        {
            ht.Clear();
            Dictionary<string, EntityMapping> entityMappings = EntityMappingContainer.EntityMappings;
            foreach( KeyValuePair<string,EntityMapping>  kvp in entityMappings)
            {
                EntityMapping _entitymapping = kvp.Value;
                string _table = string.IsNullOrEmpty(_entitymapping.Table) ? "" : _entitymapping.Table;

                List<PropertyNode> propertyNotes = _entitymapping.PropertyNodes;
                foreach(PropertyNode propertyNode in propertyNotes)
                {
                    string _prompt = string.IsNullOrEmpty(propertyNode.Prompt)?"":propertyNode.Prompt;
                    string _name = string.IsNullOrEmpty(propertyNode.Name) ? "" : propertyNode.Name;
                    string _key = "AUTO"+"$"+_table + "." + _name;
                    ht.Add(_key.ToUpper(), _prompt);
                }
            }
            return ht;
        }

    }
}
